package com.gyg.service.impl;

import com.gyg.common.VO.BlogRemarkVO;
import com.gyg.common.VO.UserRemarkVO;
import com.gyg.dao.IRemarkDao;
import com.gyg.entity.Remark;
import com.gyg.service.IRemarkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 关注公众号：码猿编程日记
 * @since 2021-10-27
 */
@Service
public class RemarkServiceImpl implements IRemarkService {

    @Autowired
    IRemarkDao iRemarkDao;

    @Override
    public List<Remark> list() {
        return iRemarkDao.list();
    }

    @Override
    public Integer save(Remark remark) {
        Map<String,Object> param = new HashMap<>();
        param.put("userId",remark.getUserId());
        param.put("blogId",remark.getBlogId());
        param.put("remark",remark.getRemark());
        param.put("created",remark.getCreated());
        param.put("status",remark.getStatus());
        return iRemarkDao.save(param);
    }

    @Override
    public Integer update(Integer id, Integer status) {
        return iRemarkDao.update(id,status);
    }

    @Override
    public Integer getFailRemarkCount() {
        return iRemarkDao.getFailRemarkCount();
    }

    @Override
    public List<BlogRemarkVO> getBlogRemarkList(Integer blogId) {
        return iRemarkDao.getBlogRemarkList(blogId);
    }

    @Override
    public List<UserRemarkVO> getUserRemarkList() {
        return iRemarkDao.getUserRemarkList();
    }
}
